package com.sk.sourcecircle.activity.home.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.sk.sourcecircle.R;
import com.sk.sourcecircle.adapter.KindAdapter;
import com.sk.sourcecircle.base.BaseActivity;
import com.sk.sourcecircle.entity.HomeTabList;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by sk on 2017/11/19.
 */

public class KindActivity extends BaseActivity implements BaseQuickAdapter.OnItemClickListener {
    @BindView(R.id.back)
    ImageView back;
    @BindView(R.id.kind_ryc)
    RecyclerView kindRyc;

    KindAdapter kindAdapter;

    ArrayList<HomeTabList.DataBean> kindList = new ArrayList<>();

    @Override
    protected int getContentView() {
        return R.layout.activity_menu_kind;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        kindList = getIntent().getParcelableArrayListExtra("data");
        kindRyc.setLayoutManager(new GridLayoutManager(mContext,3));
        kindAdapter = new KindAdapter(R.layout.item_kind,kindList);
        kindRyc.setAdapter(kindAdapter);
        kindAdapter.setOnItemClickListener(this);

    }

    @OnClick(R.id.back)
    public void onViewClicked() {
        finish();
    }

    @Override
    public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
        Intent intent = new Intent(mContext,GroupListActivity.class);
        intent.putExtra("data",kindList.get(position));
        startActivity(intent);
    }
}
